package com.egene.tw.activity.member;

import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;

import com.egene.tw.R;
import com.egene.tw.base.BaseActivity;
import com.egene.tw.dao.UserDao;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Extra;
import org.androidannotations.annotations.ViewById;

@EActivity(R.layout.activity_pdf_detail)
public class PDFDetailActivity extends BaseActivity {
    //ToolBar Views
    @ViewById(R.id.actionBar)
    Toolbar mToolbarView;
    @ViewById(R.id.toolbar_title)
    TextView mToolBarTitle;

    @ViewById(R.id.web)
    WebView wvWeb;


    @Extra
    String title;
    @Extra
    String path;

    @Bean
    UserDao userDao;

    @AfterViews
    void initViews(){
        initToolBar();
//        wvWeb.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
//        wvWeb.setWebViewClient(new WebViewClient());
//        wvWeb.setWebChromeClient(new WebChromeClient());
        wvWeb.getSettings().setJavaScriptEnabled(true);
//        wvWeb.getSettings().setDatabaseEnabled(true);
//        wvWeb.getSettings().setDomStorageEnabled(true);
//        wvWeb.getSettings().setPluginState(WebSettings.PluginState.ON);

        wvWeb.loadUrl(path);
//        wvWeb.loadUrl("http://103.17.9.110:9100//upload/201710/11/201710112255070698.pdf");
    }


    private void initToolBar() {
//        mToolBarTitle.setText(R.string.detail);
        mToolBarTitle.setText(title);
        mToolbarView.setNavigationIcon(R.drawable.ic_back);
        mToolbarView.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

}
